<?php
// require_once __DIR__ . '/vendor/autoload.php';
declare(strict_types=1);
namespace app\service;

use Czdb\DbSearcher;
use think\facade\Env;
class CZDB
{
  public static function getAddressByIP($ip)
  {

    try {
      //code...
      $databasePath = config('czdb.databasePath');
      $searchMode = config('czdb.searchMode');
      $encryptionKey = config('czdb.encryptionKey');
      $dbSearcher = new DbSearcher($databasePath, $searchMode, $encryptionKey);
      $res = $dbSearcher->search($ip);
      return $res;
    } catch (\Throwable $th) {
      //throw $th;
      return null;
    }
  }
}
